package com.bs.sc.mgr.order.dao;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.bs.sc.front.user.entity.User;
import com.bs.sc.mgr.order.entity.Order;

@Repository("orderDao")
public interface OrderDao extends JpaRepository<Order, String> {

	public List<Order> findByUser(User user);

	@Query(value = "SELECT b.comment,b.grade,c.user_name FROM confirm_order a LEFT JOIN confirm_order_item b ON a.id = b.order_id LEFT JOIN front_user c ON a.user_id = c.id WHERE  b.goods_id = ?1 AND b.`comment` IS NOT NULL LIMIT 5", nativeQuery = true)
	public List<Map<String, String>> findCommentByGoodsId(String goodsId);
}
